
/**
 * promise 形式 getAuthCode (免密)
 */
export const getAuthCode = () => {
    return new Promise((resolve, reject) => {
        dd.getAuthCode({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            }
        })
    })
}

/**
 * promise 形式 showToast(提示框)
 */
export const showToast = ({ title, duration, icon }) => {
    return new Promise((resolve, reject) => {
        uni.showToast({
            title,
            duration,
            mask: true,
            icon
        });
    })
}
/**
 * promise 形式 showToast(提示框)
 */
export const showModal = ({ title, content, callback }) => {
    return new Promise((resolve, reject) => {
        uni.showModal({
            title,
            content,
            cancelText: "取消",
            confirmText: "确定",
            success: function (res) {
                if (res.confirm) {
                    callback()
                } else if (res.cancel) {
                    console.log("用户点击取消");
                }
            },
        });
    })
}